MIME-Version: 1.0
Server: CERN/3.0
Date: Sunday, 24-Nov-96 22:34:04 GMT
Content-Type: text/html
Content-Length: 4901
Last-Modified: Friday, 22-Nov-96 17:21:18 GMT

<HTML>
<TITLE> CS211 Code Samples </TITLE>
<BODY>
<H1> Code Samples</H1>
<P> You can download these code samples by using <bf> Save As </bf>
command in the  <bf> File </bf> menu of Netscape.
</P>
<HR>
<H3> Demonstration 1 </H3>
<UL>
<LI><A HREF="add.java"> add.java </A> </LI>
<LI><A HREF="StringIO.java"> StringIO.java </A> </LI>
</UL>
<H3> Code for  dBase application (lectures 3-6) </H3>
<UL>
<LI> <A HREF="dBase.java"> dBase.java </A>. Test program <A HREF="testdBase2.java"> testdBase2.java </A> </LI>
</UL>

<H3> Solutions to assignment 1 </H3>
<UL>
<LI> <A HREF="calc.java">  Calculator </A> </LI>
<LI> <A HREF="sort.java"> Bubble Sort </A> </LI>
</UL>

<H3> Solution to assignment 2 </H3>
<UL>
<LI> <A HREF="Complex.java"> Complex Number ADT  </A> </LI>
</UL>

<H3> Code Skeletons for assignment 3 </H3>
<UL>
<LI> <A HREF="Simulator.java"> Simulator skeleton </A> <BR>

This shell program reads in files containing ADD and STOP commands,
and prints out the commands after picking apart the commands. Try it out
on the sample file <A HREF="jrm-code/first.jrm"> first.jrm </A>.

<BR>
<LI> <A HREF="JRM.out.hqx"> Complete Simulator </A> for JRM --
Downloading this will create a JRM.out.hqx. You might need to decode 
this by double clicking on the .hqx file. The executable is JRM.out.
The executable is a <A HREF="droplet.html"> droplet </A>. Run the simulator by 
dragging the code file (containing the instructions) and dropping it 
on the executable (JRM.out). Note that there are bugs in Codewarrior's
implementation of Java runtime utilities that cause certain features  to
have unexpected behaviour.

<LI> <A HREF="getint.java"> Scanning strings for register number </A>
</UL> 
<H4> Sample JRM codes </H4>
<UL>
<LI> <A HREF="jrm-code/p1.jrm"> p1.jrm </A> -
     <A HREF="jrm-code/p2.jrm"> p2.jrm </A> -
     <A HREF="jrm-code/p3.jrm"> p3.jrm </A> -
     <A HREF="jrm-code/p4.jrm"> p4.jrm </A> -
     <A HREF="jrm-code/p5.jrm"> p5.jrm </A> -
     <A HREF="jrm-code/p6.jrm"> p6.jrm </A> -
     <A HREF="jrm-code/p7.jrm"> p7.jrm </A> -
     <A HREF="jrm-code/p8.jrm"> p8.jrm </A> -
     <A HREF="jrm-code/p9.jrm"> p9.jrm </A> -
     <A HREF="jrm-code/p10.jrm"> p10.jrm </A> -
     <A HREF="jrm-code/p11.jrm"> p11.jrm </A> -
     <A HREF="jrm-code/p12.jrm"> p12.jrm </A> 	

<LI>  <A HREF="jrm-code/codesampleout"> Output for sample files </A>
</UL>

<H3> Sample shell for assignment 4 </H3>
<UL>
<LI> <A HREF="shell.java"> Simulator Shell</A> <BR>
This shell re-implements the previous assignment using inheritance and
abstract classes. Try it out on the sample file 
<A HREF="jrm-code/first.jrm"> first.jrm </A>.
</UL>

<H4> Sample JRM codes for assignment 4 </H4>
<UL>
<LI> <A HREF="jrm-code/abs.jrm"> abs.jrm </A> - (absolute value of -30).
<LI> <A HREF="jrm-code/factI.jrm"> factI.jrm  </A> - (factorial(10))
<LI> <A HREF="jrm-code/fibI.jrm"> fibI.jrm </A> - (fibonacci(10))
<LI> <A HREF="jrm-code/arithp.jrm"> arithp.jrm </A> - (summation(1..100))
<LI>  <A HREF="jrm-code/bubbleI.jrm"> bubbleI.jrm </A> - (bubble sort)
<LI>  <A HREF="jrm-code/sampleoutput"> Output for sample files </A>

</UL>

<H3> New! Multi-Threaded JRM simulator </H3> 
Downloading  <A HREF="JRM-th.out.hqx"> this </A> will create a
JRM.out.hqx. You might need to decode this by double clicking on the
.hqx file. The  executable is JRM.out. This is a runnable zip file and
not a droplet. You launch it by double clicking on the .out file. You
must first reboot (the simulator,not your mac :-) and then load the
file to be executed by using the LOAD button on the simulator.

<H3> Sample JRM code for assignment 5 </H3>
<UL>
<LI> <A HREF="jrm-code/fact-rec.jrm"> Recursive factorial code </A>
</UL>

<H3> Shells for assignment 6 </H3>
<UL> 
<LI> <A HREF="GUI.java"> A Sample GUI shell </A>
<LI> <A HREF="Simulator-GUI.java"> The code for the simulator </A>
<LI> <A HREF="SymbolTable.java"> The symbol table class </A>



</UL>
Download the three files and make a runnable zip file out of them.
Study the code in GUI.java and the code in the main() method in the
class Simulator. Some new methods have been added to the JRM class
to do the actions requested, but the JRM code is mostly the same  as
the solution to assignment 5.
<UL>
<LI> <A HREF="aGUI.java"> Example code </A> to illustrate buttons,
textfields, labels and lists.
</UL>

<H3> Complete  GUI and JRM code </H3>
Here is the complete GUI and JRM code as a stand alone
application. You can use this as the base for the applet assignment.
This code does not fix the  bugs in Lists present in CodeWarrior as
Netscape does not have these bugs.
<UL>
<LI> <A HREF="gui-complete/GUI.java"> GUI.java </A>
<LI> <A HREF="gui-complete/Simulator.java"> Simulator.java </A>
<LI> <A HREF="gui-complete/SymbolTable.java"> SymbolTable.java </A>
</UL>

Be sure to read the <A HREF="../assignments/assignment8-notes.html">
notes </A> for assignment 8.
<HR>
</BODY>
</HTML>
